package com.jsg.sl651.boot;


import com.jsg.sl651.enums.server.ServerCodeType;
import io.netty.handler.logging.LogLevel;
import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;

@ConfigurationProperties(prefix = "netty.sl651")
@Data
public class BootProperties {

    /**
     * 是否启动
     */
    private boolean enable = true;

    /**
     * IP地址
     */
    private String host = "localhost";

    /**
     * 端口
     */
    private Integer port = 12080;

    /**
     * 检查CRC
     */
    private boolean checkCrc = true;

    /**
     * 分包问题
     */
    private boolean headerDelimiter = false;

    /**
     * 服务将要支持的报文类型
     */
    private ServerCodeType serverCodeType = ServerCodeType.BOTH;

    /**
     * BOSS工作线程数量
     */
    private Integer bossThreadCount = 1;

    /**
     * WORK工作线程数量
     */
    private Integer workThreadCount = 4;

    /**
     * 业务线程池数量
     */
    private Integer businessThreadCount = 8;

    /**
     * SO_BACKLOG，未连接+已连接队列和的最大长度，超过长度后请求会被拒绝
     */
    private int backlog = 1024;

    /**
     * LogLevel
     */
    private LogLevel logLevel = LogLevel.INFO;

    /**
     * 连接保持
     */
    private boolean keepAlive = true;

    /**
     * linux情况下使用epoll
     */
    private boolean linuxUseEpoll = true;

    /**
     * 报文最小长度
     */
    private int minFrameLength = 20;

    private int maxFrameLength = 5200;

    /**
     * 物联网服务器相关信息
     */
    private boolean useTCP = false;
    private String iotHost = "192.168.31.155";
    private Integer iotPort = 1885;

    /**
     * 物联网服务器相关信息-MQTT
     */
    private boolean useMQTT = true;
    private String iotHostMQTT = "tcp://192.168.31.155:1883";
    private String productId = "1982336219521851392";
    private String secureId = "admin";
    private String secureKey = "admin";
}
